﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Mage : EntityBase
{
    [SerializeField]
    public string _currentState;
    public Mage_Orb orbPack;
    public void Start()
    {
        job = "Mage";
        Init(job);
        if(orbPack == null)
        {
            try
            {
                orbPack = GameObject.FindGameObjectWithTag("Mage_Belonging").GetComponent<Mage_Orb>();
            }catch
            {
                Debug.Log("first init player");
            }
            
        }
    }
    public override void Update()
    {
        base.Update();
        GetMousePos();
        UpdateAllSkills();
        UIManager_New.Instance.UpdateAllData(this);
    }
    public void FixedUpdate()
    {
        


            _currentState = currentState.ToString();

        
    }

    public Vector2 GetMousePos_Orb(int orbCount)
    {
        var screenPos = Camera.main.WorldToScreenPoint(transform.position);
        var mousePos = Input.mousePosition;
        mousePos.z = screenPos.z;
        var mousePosInWorld = Camera.main.ScreenToWorldPoint(mousePos);

        return (mousePosInWorld - orbPack.orbPos[orbCount].transform.position).normalized;
        
    }
    public override void Die()
    {
        base.Die();
        Destroy(this.gameObject);
    }
}
